package com.bianguo.android.apushdemo.model.impl;

import com.bianguo.android.apushdemo.model.BaseModel;
import com.bianguo.android.apushdemo.utils.MyLog;

import okhttp3.ResponseBody;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/9/12.
 */

public class LocationModel extends BaseModel {

    public void location(String address, String output, String key, Subscriber<ResponseBody> subscriber) {
        MyLog.mLog("address = " + address + ", output = " + output + ", key = " + key);
        apiService.location(address, output, key)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(subscriber);
    }

    public void location(String url, Subscriber<ResponseBody> subscriber) {
        MyLog.mLog("url = " + url);
        apiService.location(url)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(subscriber);
    }
}
